home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9254 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: hubcap.clemson.edu!hubcap!mjs
  2. From: mjs@hubcap.clemson.edu (M. J. Saltzman)
  3. Newsgroups: comp.lang.c,sci.math.num-analysis
  4. Subject: Re: C library on computation of matrix determinants
  5. Followup-To: sci.math.num-analysis
  6. Date: 7 Mar 96 01:43:49 GMT
  7. Organization: Clemson University
  8. Distribution: inet
  9. Message-ID: <mjs.826163029@hubcap>
  10. References: <wiedem01.4.000E6903@fsuni.rz.uni-passau.de> <4hl5jiINNbom@anvil.ugrad.cs.ubc.ca>
  11. NNTP-Posting-Host: hubcap.clemson.edu
  12. X-Newsreader: NN version 6.5.0 #1
  13.  
  14. In comp.lang.c, c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  15.  
  16. >In article <wiedem01.4.000E6903@fsuni.rz.uni-passau.de>,
  17. >WIEDEMANN CHRISTINE <wiedem01@fsuni.rz.uni-passau.de> wrote:
  18. >>I'm looking for a library containing source codes on how to compute a 
  19. >>determinant of a matrix. Does anybody know where to find such a library, 
  20. >>source codes or algorithms on determinant computation.
  21.  
  22. >One way to do this is to do Gaussian elimination on the matrix, while applying
  23. >the same row operations to an identity matrix. Once you isolate the pivots, the
  24. >determinant is just a product of the diagonal elements. As a bonus, if you
  25. >carry through the operations, you get the matrix inverse.
  26.  
  27. Getting the inverse is of dubious value.  For most applications, you
  28. would rather have the LU-factorization (which you get by performing
  29. Gaussian elimination and remembering the inverses of the pivots you
  30. perform).  The inverse costs more and provides less accuracy than the
  31. factorization.
  32.  
  33. Also, as I pointed out to Christine via e-mail, the determinant is 
  34. useless for deciding if a matrix is singular or not.  For that, you 
  35. want the condition number.
  36.  
  37. >The naive method of computing the determinant by recursive expansion of
  38. >cofactors/minors yields exponential complexity, whereas Gaussian runs in cubic
  39. >time in the rank of the matrix.
  40.  
  41. >[...]
  42.  
  43. >I wrote a C module a few years ago that does these kinds of things, but it is
  44. >in archival storage, unfortunately!
  45.  
  46. Good linear algebra libraries can be found at Netlib (www.netlib.org)
  47. or GAMS (gams.nist.gov), or in the list of numerical C/C++ codes
  48. posted to comp.lang.c and other groups by Ajay Shah.
  49.  
  50. >[Discussion of partial pivoting deleted]
  51.  
  52. >There is probably a better newsgroup to ask this question; perhaps something
  53. >related to numerical analysis.
  54.  
  55. That would be sci.math.num-analysis.  I've directed followups there.
  56.  
  57. -- 
  58.         Matthew Saltzman
  59.         Clemson University Math Sciences
  60.         mjs@clemson.edu
  61.